﻿using Mr.HttpBodyWrapper;

namespace OAuth
{
    public class OAuthQueryParameter
        : IOAuthParameter, IQueryParameter
    {
        private QueryParameter _inner;

        public OAuthQueryParameter(string name, string value)
            : this(name, value, true)
        { }

        public OAuthQueryParameter(string name, string value, bool inbody)
        {
            this._inner = new QueryParameter(name, value);

            this.InBody = inbody;
            this.needSign = true;
        }

        public string Name { 
            get { return this._inner.Name; } 
            set { this._inner.Name = value; } 
        }

        public string Value { 
            get { return this._inner.Value; } 
            set { this._inner.Value = value; } 
        }

        private bool needSign;
        public bool NeedSign
        {
            get
            {
                if (!this.InBody)
                {
                    this.needSign = true;
                }
                return this.needSign;
            }
        }

        public bool InBody { get; set; }

        public string ToParamString()
        {
            return this._inner.ToParamString();
        }

        public string ContentType { get; set; }
    }
}
